
import { createRouter, createWebHashHistory, createWebHistory } from "vue-router";

let dynamicRoute = []

function setRouter(folder, start) {
  for (let i = 0; i < 10; i++) {
    let tmpObj = {
      path: `/day${start + i}`,
      name: `day${start + i}`,
      component: () => import(`@/views/${folder}/day${start + i}.vue`)
    }
    dynamicRoute.push(tmpObj)
  }
}
setRouter('day1-10', 1)
// setRouter('day11-20', 11)
// setRouter('day21-30', 21)
// setRouter('day31-40', 31)
// setRouter('day41-50', 41)
// setRouter('day51-60', 51)
// setRouter('day61-70', 61)
// setRouter('day71-80', 71)

const routes = [
  { path: "/", redirect: "/day1" },
  ...dynamicRoute
]

export const router = createRouter({
  history: createWebHashHistory(),
  // history: createWebHistory(),
  routes: routes
})